import { BrowserRouter,Routes,Route,Navigate,useRoutes} from 'react-router'
import React from 'react'

//路由懒加载
const Login =React.lazy(()=>import('../pages/Login'))
const NoteClass =React.lazy(()=>import('../pages/NoteClass'))
const Register =React.lazy(()=>import('../pages/Register'))
const NoteList =React.lazy(()=>import('../pages/NoteList'))
const NoteDetail =React.lazy(()=>import('../pages/NoteDetail'))
const NotePublish =React.lazy(()=>import('../pages/NotePublish'))

const routes = [
    {
        path:'/',
        element:<Navigate to="/noteClass" />
    },
    {
        path:'/login',
        element:<Login />
    },
    {
        path:'/noteClass',
        element:<NoteClass />
    } ,
    {
        path:'/register',
        element:<Register />
    },
    {
        path:'/notelist',
        element:<NoteList />
    },
    {
        path:'/notedetail',
        element:<NoteDetail />
    },
    {
        path:'/notepublish',
        element:<NotePublish />
    }
]

function WrapperRoutes(){
    let ele =useRoutes(routes)
    return ele
}

export default function WrapperRouter() {
    return(
        <BrowserRouter>
           <WrapperRoutes />
        </BrowserRouter>
    )
} 